//createRouter：创建路由实例
//createWebHistory：创建history模式的路由
import { createRouter, createWebHistory } from 'vue-router'
import login from '@/views/Login/index.vue'
import logout from '@/views/Logout/index.vue'
// 主页面
import Home from '@/views/Home/index.vue'
import Category from '@/views/Category/index.vue'
// 审核
import Audit from '@/views/Audit/index.vue'
import ProjectAudit from '@/views/Audit/ProjectAudit/ProjectAudit.vue'
import UserAudit from '@/views/Audit/UserAudit/UserAudit.vue'
// 管理
import Manage from '@/views/Manage/index.vue'
import UserManage from '@/views/Manage/UserManage/index.vue'
import PositionManage from '@/views/Manage/PositionManage/index.vue'
import RoleManage from '@/views/Manage/RoleManage/index.vue'
import UnitManage from '@/views/Manage/UnitManage/index.vue'
// 设置
import Settings from '@/views/Set/index.vue'
import LogSettings from '@/views/Set/LogSettings/index.vue'
import LogManage from '@/views/Set/LogManage/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  //path和component对应关系的位置
  routes: [
    {
      path: '/',
      name: 'home',
      meta: {title:'首页'},
      component: logout,
      children: [
      {
          path: '',
          name: 'home',
          meta: {title:'首页'},
          component: Home
      },
      {
        path: '/category',
        component:Category
      },
      {
        path: '/audit',
        meta: {title:'模型可视化'},
        component:Audit,
        children: [
          {
            path: '/audit/projectaudit',
            meta: {title:'性能可视化'},
            component:ProjectAudit
          },
          {
            path: '/audit/useraudit',
            meta: {title:'结果可视化'},
            component: UserAudit
          },
        ]
      },
      {
        path: '/manage',
        meta: {title:'信息管理'},
        component: Manage,
        children: [
          {
            path: '/manage/usermanage',
            meta: {title:'用户管理'},
            component: UserManage
          },
          {
            path: '/manage/positionmanage',
            meta: {title:'职位管理'},
            component: PositionManage
          },
          {
            path: '/manage/rolemanage',
            meta: {title:'角色管理'},
            component: RoleManage
          },
          {
            path: '/manage/unitmanage',
            meta: {title:'单位管理'},
            component: UnitManage
          },
        ]
      },
      {
        path: '/settings',
        meta: {title:'系统设置'},
        component:Settings,
        children: [
          {
            path: '/settings/logsettings',
            meta: {title:'日志设置'},
            component: LogSettings,
          },
          {
            path: '/settings/logmanage',
            meta: {title:'日志管理'},
            component: LogManage,
          },
        ]
      },
      ]
    },
    //登入页面路由
    {
      path: '/login',
      component: login
    },
  ]
})

export default router
